function Usage
{
    Write-Host "Usage :"
    Write-Host ""
    Write-Host "    Since you're going to create an AppFabric cache,"
    Write-Host "     this script obviously needs AppFabric installed and preconfigured."
    Write-Host ""
    Write-Host "    RockBus.CreateCache.ps1 <user> <cachename>"
    Write-Host "    (N.B. The cache name needs to match the cacheManagerConfiguration.CacheName"
    Write-Host "     property in the configuration file)"
    Write-Host ""
    exit;
}

$User = $Args[0]
if($User -eq $null)
{
    Usage;
}

$CacheName = $Args[1]
if($CacheName -eq $null)
{
    Usage;
}

Import-Module DistributedCacheAdministration
Use-CacheCluster
Restart-CacheCluster
Grant-CacheAllowedClientAccount $User
New-Cache -CacheName $CacheName -NotificationsEnabled True -Eviction LRU -TimeToLive 1 -Expirable True
Get-CacheStatistics $CacheName
